<?
	require_once('init.php');
	require_once('dataModel.php');

	$SizeID=$_GET['ID'];
	$Type=$_GET['Type'];
	$pgno=$_GET['pgno'];
    
    if ($Type==0)
    {
    	$Title="新增配码资料";
		$strSQL = "select * from size where 1=0";
		$imtype="0";
	}
    else if ($Type==1)
    {
    	$Title="修改配码资料";
		$strSQL = "select * from size where id='".$SizeID."' ";
    }

	$db = MySQL::getInstance('','r-w'); 
	$DBR=$db->query($strSQL); 
  	$result=$db->fetch($DBR);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=<?=$lng_characset;?>" />
	<title><?=$AllPageTitle;?></title>
	<link href="css/CenterMenu.css" rel="stylesheet" type="text/css" />
	<link rel="stylesheet" href="css/Buttonstyle.css" type="text/css" media="screen" />	
	
	<? include("alljs.php"); ?>
	
	<script language="javascript">
		function goback(pgno)
		{
			self.location='sizemanager.php?pgno='+pgno
		}

		function CheckData()
		{
			value = $("#remark").attr("value");
	       	if( value=="")
	       	{
				parent.hiAlert("请输入配码说明!", '<?=$strclueinfo;?>');
				$("#remark").focus();
				return false;
	        }

			var strSQL = "";                      
			strSQL+= "&remark=";
			strSQL+=$("#remark").attr("value");
			strSQL+= "&size01=";
			strSQL+=$("#size01").attr("value");
			strSQL+= "&size02=";
			strSQL+=$("#size02").attr("value");
			strSQL+= "&size03=";
			strSQL+=$("#size03").attr("value");
			strSQL+= "&size04=";
			strSQL+=$("#size04").attr("value");
			strSQL+= "&size05=";
			strSQL+=$("#size05").attr("value");
			strSQL+= "&size06=";
			strSQL+=$("#size06").attr("value");
			strSQL+= "&size07=";
			strSQL+=$("#size07").attr("value");
			strSQL+= "&size08=";
			strSQL+=$("#size08").attr("value");
			strSQL+= "&size09=";
			strSQL+=$("#size09").attr("value");
			strSQL+= "&size10=";
			strSQL+=$("#size10").attr("value");
//			strSQL+= "&size11=";
//			strSQL+=$("#size11").attr("value");
//			strSQL+= "&size12=";
//			strSQL+=$("#size12").attr("value");
//			strSQL+= "&size13=";
//			strSQL+=$("#size13").attr("value");
//			strSQL+= "&size14=";
//			strSQL+=$("#size14").attr("value");
//			strSQL+= "&size15=";
//			strSQL+=$("#size15").attr("value");
			strSQL+= "&Type=AddSize";
			
//			alert (strSQL);
			
			$.post("varifyData.php",strSQL,function(msg)
			{

//			    alert (msg);
			    
			   	if (msg=='1')
			   	{	
					parent.hiAlert("<?=$strsavesuccess;?>!", '<?=$strclueinfo;?>');
					
					$("#remark").attr("value","");
					$("#size01").attr("value","");
					$("#size02").attr("value","");
					$("#size03").attr("value","");
					$("#size04").attr("value","");
					$("#size05").attr("value","");
					$("#size06").attr("value","");
					$("#size07").attr("value","");
					$("#size08").attr("value","");
					$("#size09").attr("value","");
					$("#size10").attr("value","");
//					$("#size11").attr("value","");
//					$("#size12").attr("value","");
//					$("#size13").attr("value","");
//					$("#size14").attr("value","");
//					$("#size15").attr("value","");

					$("#remark").focus();
					return false;
			   	}
			})
	        
		}

   		function CheckDataEdit(EID)
   		{
			value = $("#remark").attr("value");
	       	if( value=="")
	       	{
				parent.hiAlert("请输入配码说明!", '<?=$strclueinfo;?>');
				$("#remark").focus();
				return false;
	        }

			var strSQL = "";                      
			strSQL+= "&EID="+EID;
			strSQL+= "&remark=";
			strSQL+=$("#remark").attr("value");
			strSQL+= "&size01=";
			strSQL+=$("#size01").attr("value");
			strSQL+= "&size02=";
			strSQL+=$("#size02").attr("value");
			strSQL+= "&size03=";
			strSQL+=$("#size03").attr("value");
			strSQL+= "&size04=";
			strSQL+=$("#size04").attr("value");
			strSQL+= "&size05=";
			strSQL+=$("#size05").attr("value");
			strSQL+= "&size06=";
			strSQL+=$("#size06").attr("value");
			strSQL+= "&size07=";
			strSQL+=$("#size07").attr("value");
			strSQL+= "&size08=";
			strSQL+=$("#size08").attr("value");
			strSQL+= "&size09=";
			strSQL+=$("#size09").attr("value");
			strSQL+= "&size10=";
			strSQL+=$("#size10").attr("value");
//			strSQL+= "&size11=";
//			strSQL+=$("#size11").attr("value");
//			strSQL+= "&size12=";
//			strSQL+=$("#size12").attr("value");
//			strSQL+= "&size13=";
//			strSQL+=$("#size13").attr("value");
//			strSQL+= "&size14=";
//			strSQL+=$("#size14").attr("value");
//			strSQL+= "&size15=";
//			strSQL+=$("#size15").attr("value");
			strSQL+= "&Type=EditSize";
			
//			alert (strSQL);
			
			$.post("varifyData.php",strSQL,function(msg)
			{

//			    alert (msg);
			    
			   	if (msg=='1')
			   	{	
					parent.hiAlert("<?=$strsavesuccess;?>!", '<?=$strclueinfo;?>');
					
					$("#remark").focus();
					return false;
			   	}
			})
	        
	    }    
	</script>
</head>


<body>
	<div id="MenuRighttitle" ><div style="padding-left:245px;padding-top:5px;"><b><?=$Title;?></b></div></div>

	<div class="inner-container">
		<div class="bodypart" style="border:0px solid blue;">	
			<div style="padding-left: 10px; margin-top: 20px; text-align: left; height:auto;border:0px solid blue;">

				<div class="coloraddnew_a01"><?=$strRemark.":";?></div>
				<div class="coloraddnew_a02" ><input type="text" id="remark" name="remark" value="<?=$result["remark"];?>" size="30" maxlength="20" class="goodsaddnew_textbox" style="width:280px;" /></div>

				<div class="coloraddnew_a01"><?="配码:";?></div>
				<div class="coloraddnew_a02" >
					<input type="text" id="size01" name="size01" value="<?=$result["size01"];?>" size="30" maxlength="5" class="goodsaddnew_textbox" style="width:35px;" />
					<input type="text" id="size02" name="size02" value="<?=$result["size02"];?>" size="30" maxlength="5" class="goodsaddnew_textbox" style="width:35px;margin-left:10px;" />
					<input type="text" id="size03" name="size03" value="<?=$result["size03"];?>" size="30" maxlength="5" class="goodsaddnew_textbox" style="width:35px;margin-left:10px;" />
					<input type="text" id="size04" name="size04" value="<?=$result["size04"];?>" size="30" maxlength="5" class="goodsaddnew_textbox" style="width:35px;margin-left:10px;" />
					<input type="text" id="size05" name="size05" value="<?=$result["size05"];?>" size="30" maxlength="5" class="goodsaddnew_textbox" style="width:35px;margin-left:10px;" />
					<input type="text" id="size06" name="size06" value="<?=$result["size06"];?>" size="30" maxlength="5" class="goodsaddnew_textbox" style="width:35px;margin-left:10px;" />
					<input type="text" id="size07" name="size07" value="<?=$result["size07"];?>" size="30" maxlength="5" class="goodsaddnew_textbox" style="width:35px;margin-left:10px;" />
					<input type="text" id="size08" name="size08" value="<?=$result["size08"];?>" size="30" maxlength="5" class="goodsaddnew_textbox" style="width:35px;margin-left:10px;" />
					<input type="text" id="size09" name="size09" value="<?=$result["size09"];?>" size="30" maxlength="5" class="goodsaddnew_textbox" style="width:35px;margin-left:10px;" />
					<input type="text" id="size10" name="size10" value="<?=$result["size10"];?>" size="30" maxlength="5" class="goodsaddnew_textbox" style="width:35px;margin-left:10px;" />
				</div>

				<div class="coloraddnew_a01" style="margin-top: 50px;width:700px;text-align:center;border:0px solid blue;">
					<?
					if ($Type==0)
					{
					?>
						<input type="image" name="image" value="image" src="images/submit_btn.gif" onclick="javascript:CheckData();" /> 
					<?
					}
					else if ($Type==1)
					{
					?>
						<input type="image" name="image" value="image" src="images/submit_btn.gif" onclick="javascript:CheckDataEdit('<?=$result["id"];?>');" />
					<?
					}
					?>


					<input type="image" name="image" value="image" src="images/go_btn.gif" onclick="javascript:goback('<?=$pgno;?>');" /> 
				</div>
			</div>
		</div>
	</div>
</body>

</html>
